package org.xxmi.cors.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.xxmi.cors.model.UploadFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api")
public class Login {
    private static final Logger logger = LoggerFactory.getLogger(Login.class);

    @GetMapping("/login")
    public Map login(HttpServletRequest request, HttpServletResponse response) {
        Enumeration<String> headerNames = request.getHeaderNames();
        while (headerNames.hasMoreElements()) {
            String headerName = headerNames.nextElement();
            String value = request.getHeader(headerName);
            logger.info("headerName：{},     value: {}", headerName, value);
        }
        Map result = new HashMap();
        result.put("msg", "登录成功");
        result.put("code", 200);
        return result;
    }
}
